#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7, SG = 26;
typedef long long ll;
#define rep(i, a, b) for (int i = (a); i < (b); ++i)

struct Mat {
  ll f[SG][SG];
  Mat() { memset(f, 0, sizeof(f)); }
  Mat operator*(const Mat &b) const {
    Mat m;
    rep(i, 0, SG) rep(j, 0, SG) rep(k, 0, SG) {
      (m.f[i][j] += f[i][k] * b.f[k][j] % MOD) %= MOD;
    }
    return m;
  }
};
Mat matpow(Mat a, ll b) {
  Mat m;
  rep(i, 0, SG) m.f[i][i] = 1;
  for (; b; a = a * a, b >>= 1) {
    if (b & 1) m = m * a;
  }
  return m;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Mat G, A, SumG;
  rep(i, 0, SG) {
    A.f[0][i] = SumG.f[i][0] = 1;
    rep(j, 0, SG) G.f[i][j] = 1;
  }
  ll n;
  string s;
  cin >> n >> s;
  rep(i, 1, s.size()) G.f[s[i - 1] - 'a'][s[i] - 'a'] = 0;
  cout << (A * matpow(G, n - 1) * SumG).f[0][0] << endl;
}
